<%@page import="service.EmployeeAPI"%>
<%@page import="model.Employee"%>
<%@page import="service.implement.EmployeeDAO"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript" src="js/jquery-2.0.3.js"></script>
<script type="text/javascript" src="js/jquery.validate.js"></script>
<script type="text/javascript">
	function validateForm() {
		var name = document.forms["form"]["name"].value;
		var username = document.forms["form"]["username"].value;
		var email = document.forms["form"]["email"].value;
		if (name == "") {
			alert("Name khong duoc trong");
			return false;
		}
		if (username == "") {
			alert("Username khong duoc trong");
			return false;
		}
		if (email == "") {
			alert("Email khong duoc trong");
			return false;
		}
	}
</script>
</head>
<body>
	<%@ include file="Menu.jsp"%>
	<%
		int id1 = Integer.parseInt(request.getParameter("checkEmployee"));
		EmployeeDAO dao = new EmployeeDAO();
		Employee em = dao.getEmployeeById(id1);
	%>
	<div class="panel panel-default">
		<!-- Default panel contents -->
		<legend>Update Employee:</legend>
		
		<form class="form-horizontal" action="doupdateEmployee" method="post"
			name="form" onsubmit="return validateForm()">
			<fieldset>
			<div class="form-group">
				<label for="inputEmail3" class="col-sm-2 control-label">Id</label>
				<div class="col-sm-10">
					<label><%=em.getId()%></label>
				</div>
				<input type="hidden" name="id" value="<%=em.getId()%>"
					readonly="readonly" />
			</div>
			<div class="form-group">
				<label for="inputEmail3" class="col-sm-2 control-label">Name</label>
				<div class="col-sm-10">
					<input type="text" name="name" value="<%=em.getName()%>" />
				</div>
			</div>
			<div class="form-group">
				<label for="inputPassword3" class="col-sm-2 control-label">Username</label>
				<div class="col-sm-10">
					<input type="text" name="username" value="<%=em.getUsername()%>" />
				</div>
			</div>
			<div class="form-group">
				<label for="inputEmail3" class="col-sm-2 control-label">Email</label>
				<div class="col-sm-10">
					<input type="text" name="email" value="<%=em.getEmail()%>" />
				</div>
			</div>
			<div class="form-group">
				<label for="inputEmail3" class="col-sm-2 control-label"></label>
				<div class="col-sm-10">
					<input type="submit" name="update" value="Update" />
				</div>
			</div>
</fieldset>
		</form>
	</div>
</body>
</html>